The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this, section qualify as prior art merely by virtue of their inclusion in this section.
The Extensible Markup Language (XML) is the standard for data and documents that is finding wide acceptance in the computer industry. XML describes and provides structure to a body of data, such as a file or data packet. The XML standard provides for tags that delimit sections of an XML entity referred to as XML elements. The following XML document A is provided to illustrate XML.
XML document A<a c=“foo”>  <b>5</b>  <d>10</d></a>
XML elements are delimited by a start tag and a corresponding end tag. For example, segment A contains the start tag <b> and the end tag </b> to delimit an element. The data between the elements is referred to as the element's content.
An element has a name and is referred to herein by its name. The name of the element delimited by the open tag <b> and the end tag </b> is b and is thus referred to herein as element b or just b.
An element's content may include the elements value, one or more attributes and/or one or more elements. Element a contains two elements b and d. An element that is contained by another element is referred to as a descendant of that element. Thus, elements b and d are descendants of element a. An element's attributes are also referred to as being contained by the element.
An attribute is a name value pair. Element a has attribute c, which has the value ‘foo’.
Element b has the value 5 and element d has the value 10. Element a does not have a value.
By defining elements that contain attributes and descendant elements, an XML document defines a hierarchical tree relationship between the elements, descendant elements, and attributes of the elements.
Node Tree Model
An important standard for XML is the XQuery 1.0 and XPath 2.0 Data Model. (see W3C Working Draft 9 Jul. 2004, which is incorporated herein by reference) One aspect of this model is that an XML document is represented by a hierarchy of nodes that reflects the XML document's hierarchical nature.
A hierarchy of nodes is composed of nodes at multiple levels. The nodes at each level are each linked to one or more nodes at a different level. Each node at a level below the top level is a child node of one or more of the parent nodes at the level above. Nodes at the same level are sibling nodes.
In a tree hierarchy or node tree, each child node has only one parent node, but a parent node may have multiple child nodes. In a tree hierarchy, the node that has no parent node linked to it is the root node, and a node that has no child nodes linked to it is a leaf node. A tree hierarchy has a single root node. In a node tree that represents an XML document, a node can correspond to an element, and the child nodes of the node correspond to an attribute or another element contained in the element.
For convenience of expression, an element and attribute of an XML document are referred to as the node that corresponds to that element or attribute within the node tree that represents the XML document. Thus, referring to 5 as the value of node b is just a convenient way of expressing that the value of the element b is 5.
The nodes of an XML document descend from the same root node. An XML document may contain subtrees of nodes that descend from a non-root node. The subtree may also be referred to herein as an XML document or as a fragment of the XML document that contains the subtree.
Xml Storage Mechanisms
Various types of storage mechanisms are used to store an XML document. One type of storage mechanism stores an XML document as a text file in a file system.
Another type of mechanism for storing XML documents is a database server. In a database server, an XML document may be stored in a row of a table and nodes of the XML document are stored in separate columns in the row. An entire XML document may also be stored in a LOB (large object) in a column. An XML document may also be stored as a hierarchy of objects in a database; each object is an instance of an object class and stores one or more elements of an XML document. The object class defines, for example, the structure corresponding to an element, and includes references or pointers to objects representing the immediate descendants of the element. Tables and/or objects of a database system that hold XML values are referred to herein as base tables or objects.
Multi-tier Architectures and Terminology
Computer systems that process XML documents usually follow a multi-tier model in which a “source tier” supplies either all or portions of XML documents and one or more other tiers directly or indirectly interact with the source tier to retrieve all or part of the one or more XML documents.
Computer systems that use database servers to store XML documents are typically implemented in a multi-tier architecture that has a database server in the source tier (“database tier”) and one or more outer tiers that interact, directly or indirectly, with the database tier. When a tier interacts indirectly with a source tier, the tier acts through one or more middle tiers. Any entity within a tier that interacts directly or indirectly with the source tier is referred to as a client with respect to the source tier. Any outer tier is referred to herein as a client tier.
For example, an application server in the middle tier may interact with a database server in a database tier. The application server is a client of a database server and is in the client tier. A browser process on another computer connected to the application server's computer may indirectly retrieve part of an XML document from the database server by requesting and retrieving it from the application server. The browser process is in a client tier different than the tier of the application server and is also a client of the database tier and database server.
Typically, but not always, interaction between a client tier and the source tier involves interaction between different processes and computers in the respective tiers. The process in the client tier may be executing on a computer in the client tier that is interconnected via a network to another computer in the source tier. The tiers usually interact via an application program interface, which typically involves inter-process remote procedure calls between tiers.
XML Operations Supported By Database Server
Database servers that store XML documents may be enhanced to efficiently perform XML operations. One type of operation is to execute queries over collections of XML documents using XML query languages, such as XQuery/XPath. XML Query Language (“XQuery”) and XML Path Language (“XPath”) are important standards for a query language, which can be used in conjunction with SQL to express a large variety of useful queries. XPath is described in XML Path Language (Xpath), version 1.0 (W3C Recommendation 16 Nov. 1999), which is incorporated herein by reference.
For various reasons, XML operations are performed outside the database tier in the client tier. An example of one such reason is to shift workload from the database tier to the client tier. However, XML operations in the client tier may not be performed as efficiently as XML operations performed in the database tier by a database server that has been enhanced to perform XML operations. Thus, client tier execution of XML operations suffers from performance degradation.
Based on the foregoing, there is a clear need to develop approaches that improve the efficiency of XML operations performed in the client tier.